% TEST_ID: LANG-EXPAND-0123
% CATEGORY: language/string
% 测试 string 的空格删除

function test_string_strip()
x = ' abc ';
y = strip(x);
assert(strcmp(y, 'abc'));

y = strip(x, 'left');
assert(strcmp(y, 'abc '));
y = strip(x, 'right');
assert(strcmp(y, ' abc'));

x = {'eabc ', 'eabce', ' abce'};
y = strip(x, 'both', 'e');
assert(strcmp(y{1}, 'abc '));
assert(strcmp(y{2}, 'abc'));
assert(strcmp(y{3}, ' abc'));

x = [sprintf('\t'), 'abc', sprintf('\t')];
y = strip(x);
assert(strcmp(y, 'abc'));

x = [sprintf('\n'), sprintf('\t'), ' abc ', sprintf('\t')];
y = strip(x);
assert(strcmp(y, 'abc'));
